<template>
  <div class="item">
    <div class="info">
      <div class="number">
        <span class="value" :style="{color: colors1[index]}">{{ item.num }}</span>
        <span class="danwei">{{ item.unit }}</span>
      </div>
      <p class="title">
        {{ item.title }}
      </p>
    </div>
    <div class="imgContainer" :class="{['bgImg' + index]: true}"></div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      colors1: ['#006b6b', '#F7BA1E', '#30CF7E', '#818FAF', '#0FBDF0'],
    }
  },
  props: {
    index: {
      type: Number,
      required: true
    },
    item: {
      type: Object,
      required: true
    }
  },
}
</script>

<style lang="scss" scoped>
.imgContainer {
  width: 60px;
  height: 60px;
  &.bgImg0 {
    background: url(../../../assets/img/topIcon0.png) no-repeat;
    background-size: 100% 100%;
  }
  &.bgImg1 {
    background: url(../../../assets/img/topIcon1.png) no-repeat;
    background-size: 100% 100%;
  }
  &.bgImg2 {
    background: url(../../../assets/img/topIcon2.png) no-repeat;
    background-size: 100% 100%;
  }
  &.bgImg3 {
    background: url(../../../assets/img/topIcon3.png) no-repeat;
    background-size: 100% 100%;
  }
  &.bgImg4 {
    background: url(../../../assets/img/topIcon4.png) no-repeat;
    background-size: 100% 100%;
  }
}
.title {
  font-size: 18px;
  color: #242939;
  font-weight: bold;
  margin-top: 15px;
}
.number {
  display: flex;
  align-items: center;
  .danwei {
    font-size: 14px;
    color: #4b5575;
    margin-left: 15px;
  }
  .value {
    font-size: 26px;
    line-height: 33px;
  }
}
.item {
  flex: 1;
  margin-right: 16px;
  height: 115px;
  background-image: linear-gradient(180deg, #ffffff 0%, #ffffff 50%);
  border: 1px solid #ffffff;
  box-shadow: 0 4px 8px -4px #24293914;
  border-radius: 4px;
  box-sizing: border-box;
  padding: 12px 20px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.item:last-child {
  margin-right: 0;
}
</style>